//
//  YCBarButton+UIBarButtoItem.swift
//  swift微博
//
//  Created by 姚伟聪 on 15/12/21.
//  Copyright © 2015年 姚伟聪. All rights reserved.
//
//ccccccccc
import UIKit

extension UIBarButtonItem {

    convenience init(imageName: String){
       
        let hilightImageName = imageName + "_highlighted"
      
        let button = UIButton()
        button.setBackgroundImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: hilightImageName), forState: UIControlState.Highlighted)
        button.sizeToFit()
    //sss
        self.init(customView: button)
    }
    
    class func creatBarButtonItem(imageName: String) -> UIBarButtonItem{
    
        let button = UIBarButtonItem(imageName: imageName)
        
        return button
    
    
    }
    


}